import './plugins/axios'
import {createApp} from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// import axios from './axios'

// 引入全局样式
import './assets/css/global.css'

import Axios from './config/axios.js'

import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'

// 如果您正在使用CDN引入，请删除下面一行。
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

var app = createApp(App)
app.use(ElementPlus)
app.use(store).use(router).mount('#app')

//配置默认IP地址
// Axios.defaults.baseURL='http://10.10.166.89:8081/'
Axios.defaults.baseURL='http://10.10.184.8:8081/'
// Axios.defaults.baseURL='http://localhost:8081/'
// Axios.defaults.headers.post['Content-Type'] = 'application/form-data';
// Axios.defaults.headers.get['Content-Type'] = 'application/form-data';
Axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
Axios.defaults.headers.get['Content-Type'] = 'application/x-www-form-urlencoded';

// 携带cookie
// Axios.defaults.withCredentials = true
app.config.globalProperties.$axios=Axios;  //配置axios的全局引用

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}



import Enum from 'vue-enum'

let enumInfo = {
    STATE: {
        SUCCESS: {
            value: "200",
            desc: "执行成功"
        },
        FAIL: {
            value: "201",
            desc: "执行失败"
        },

        
        USER_NONEXIST: {
            value: "210",
            desc: "用户不存在"
        },
        USER_EXIST: {
            value: "211",
            desc: "用户已存在"
        },
        PASSWORD_WRONG: {
            value: "212",
            desc: "密码错误"
        },


        HW_STORE_FAILED: {
            value: "226",
            desc: "作业存储失败"
        },
        HW_EXIST: {
            value: "227",
            desc: "作业已提交过"
        },
        DATA_NULL: {
            value: "241",
            desc: "值为空"
        },

        LOGIN_OUT: {
            value: "250",
            desc: '退出登录成功'
        },
        LOGIN_OVERDUE: {
            value: "400",
            desc: '登录过期,重新登录'
        },
        LOGIN_NOT: {
            value: "401",
            desc: '未登录'
        },
        LOGIN_SUCCESS: {
            value: "402",
            desc: '登录成功'
        },
        ROLE_FAILED: {
            value: "221",
            desc: '身份异常'
        },
        ROLE_NONEXIST: {
            value: "222",
            desc: '不存在该角色'
        },
        ROLE_NONROLE_INSUFFICIENT_PERMISSIONSEXIST: {
            value: "223",
            desc: '权限不足'
        },
        DATABASE_WRONG:{
            value: "501",
            desc:"数据库执行错误"
        }
    }
}

app.use(Enum,{enumInfo})